function a(a, t) {
    if (!(a instanceof t)) throw new TypeError("Cannot call a class as a function");
}

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.ParseChe = void 0;

var t = function() {
    function a(a, t) {
        for (var e = 0; e < t.length; e++) {
            var n = t[e];
            n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), 
            Object.defineProperty(a, n.key, n);
        }
    }
    return function(t, e, n) {
        return e && a(t.prototype, e), n && a(t, n), t;
    };
}(), e = require("../../../../data/che-data"), n = function() {
    function n(t) {
        a(this, n), this._this = t, this.cheData = e.cheData, this.init();
    }
    return t(n, [ {
        key: "init",
        value: function() {
            var a = this, t = this._this;
            t.setData({
                indexs: this.getIndexArr(),
                cars: this.getAllCheArr(),
                value: [ 0, 0 ]
            }), this.animationEvents(t, 200, !1), t.hiddenFloatView = function() {
                t.data.isShowPicker ? a.animationEvents(t, 200, !0) : (t.setData({
                    value: t.data.value
                }), a.animationEvents(t, 0, !0), void 0 === t.data.car && t.setData({
                    car: t.data.cars[t.data.value[0]].name
                }));
            }, t.bindChange = function(e) {
                var n = e.detail.value;
                a.pickerChange(n), t.setData({
                    value: n
                });
            };
        }
    }, {
        key: "getIndexArr",
        value: function() {
            var a = [], t = this.cheData, e = "#";
            a.push("#");
            for (var n in t) t[n].index !== e && (e = t[n].index, a.push(t[n].index));
            return a;
        }
    }, {
        key: "getAllCheArr",
        value: function() {
            var a = [];
            for (var t in this.cheData) a.push({
                brandId: parseInt(t) + 1,
                name: this.cheData[t].name,
                index: this.cheData[t].index,
                icon: this.cheData[t].icon
            });
            return a;
        }
    }, {
        key: "pickerChange",
        value: function(a) {
            var t = this.getIndexArr(), e = this.getAllCheArr(), n = [];
            if (a[0] != this._this.data.value[0]) {
                var i = t[a[0]];
                if ("#" === i) n = e; else for (var r in e) e[r].index === i && n.push({
                    brandId: e[r].brandId,
                    name: e[r].name,
                    icon: e[r].icon
                });
                a[1] = 0, this._this.setData({
                    cars: n,
                    car: n[0].name,
                    brandId: n[0].brandId,
                    value: a
                });
            } else this._this.setData({
                brandId: this._this.data.cars[a[1]].brandId,
                car: this._this.data.cars[a[1]].name
            });
        }
    }, {
        key: "animationEvents",
        value: function(a, t, e) {
            a.animation = wx.createAnimation({
                transformOrigin: "50% 50%",
                timingFunction: "ease",
                delay: 0
            }), a.animation.translateY(t + "vh").step(), e ? a.setData({
                animation: a.animation.export(),
                isShowPicker: !a.data.isShowPicker
            }) : a.setData({
                animation: a.animation.export()
            });
        }
    } ]), n;
}();

exports.ParseChe = n;